FROM golang:alpine AS build
WORKDIR /app

# install build dependencies
RUN apk add --no-cache build-base git && \
    apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing yara-dev

# copy and build PMF
COPY . .
RUN make

FROM golang:alpine
LABEL org.opencontainers.image.source="https://github.com/jvoisin/php-malware-finder"
WORKDIR /app

# install dependencies
RUN apk add --no-cache libressl && \
    apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing yara

# copy binary from build container
COPY --from=build /app/php-malware-finder /app

ENTRYPOINT ["/app/php-malware-finder", "-v", "-a", "-c", "/data"]
